package com.juyu.miliao.api.service;

import com.juyu.miliao.api.dao.mysql.UserLoginDao;
import com.juyu.miliao.common.exception.ConsumeRuntimeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;

/**
 * @author xuanqicheng
 */
@Service
public class UserLoginService {
    @Autowired
    private UserLoginDao userLoginDao;

    public void checkPhone(String phoneNum) {
        int num  = userLoginDao.checkPhone(phoneNum);
        if(num>0){
            throw new ConsumeRuntimeException("999","手机号已经注册过！", HttpStatus.BAD_REQUEST);
        }
    }
}
